"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));

var _jsxRuntime = require("react/jsx-runtime");

var _antdV = require("antd-v4");

var _react = require("react");

var _DropdownFooter = _interopRequireDefault(require("../DropdownFooter"));

require("./index.less");

var FilterDropdown = function FilterDropdown(props) {
  var children = props.children,
      label = props.label,
      footer = props.footer,
      disabled = props.disabled,
      onVisibleChange = props.onVisibleChange,
      visible = props.visible,
      footerRender = props.footerRender,
      placement = props.placement;

  var _useContext = (0, _react.useContext)(_antdV.ConfigProvider.ConfigContext),
      getPrefixCls = _useContext.getPrefixCls;

  var prefixCls = getPrefixCls('pro-core-field-dropdown');
  return (0, _jsxRuntime.jsx)(_antdV.Dropdown, {
    disabled: disabled,
    placement: placement,
    trigger: ['click'],
    visible: visible,
    onVisibleChange: onVisibleChange,
    overlay: (0, _jsxRuntime.jsxs)("div", {
      className: "".concat(prefixCls, "-overlay"),
      children: [(0, _jsxRuntime.jsx)("div", {
        className: "".concat(prefixCls, "-content"),
        children: children
      }), footer && (0, _jsxRuntime.jsx)(_DropdownFooter.default, (0, _objectSpread2.default)({
        disabled: disabled,
        footerRender: footerRender
      }, footer))]
    }),
    children: (0, _jsxRuntime.jsx)("span", {
      className: "".concat(prefixCls, "-label"),
      children: label
    })
  });
};

var _default = FilterDropdown;
exports.default = _default;